package com.zzh.dialog.xpop.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.zzh.dialog.xpop.XPopupApp;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

/**
 * Description:
 * Create by dance, at 2018/12/9
 */
public abstract class BaseFragment extends Fragment {
    View view;
    boolean isInit = false;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (view == null) {
            view = inflater.inflate(getLayoutId(), container, false);
            init(view);
        }
        return view;
    }

    @Override
    public void onResume() {
        super.onResume();
    }


    protected abstract int getLayoutId();

    public abstract void init(View view);

    public void toast(String msg) {
        Toast.makeText(XPopupApp.context, msg, Toast.LENGTH_SHORT).show();
    }

}
